Skip to content

feat(contrib/aws/aws-sdk-go-v2): add SQS Data Streams consume checkpoints - #5902

Open
robcarlan-datadog wants to merge 9 commits into
mainfrom
rob.carlan/dsm2-676-sqs-consume-checkpoints
Open

robcarlan-datadog wants to merge 9 commits into
mainfrom
rob.carlan/dsm2-676-sqs-consume-checkpoints

Conversation

@robcarlan-datadog

@robcarlan-datadog robcarlan-datadog commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Data Streams Monitoring for aws-sdk-go-v2 SQS, on both sides:

  • Produce (SendMessage, SendMessageBatch): sets a direction:out,type:sqs,topic:<queue> checkpoint per message and injects the pathway into the message's _datadog attribute. Main already did this whenever the tracer's DSM processor ran; it now follows DD_DATA_STREAMS_ENABLED.
  • Consume (ReceiveMessage), new: asks SQS for the _datadog attribute (unless All or .* is already requested), sets one direction:in,type:sqs,topic:<queue> checkpoint per message with the producer's pathway as parent, and writes the new pathway back into _datadog. It reads the pathway from a String or Binary _datadog attribute, or from the SNS notification in the body when SNS raw delivery is off.

Both turn on with DD_DATA_STREAMS_ENABLED=true. There's no new public option. A per-integration WithDataStreams() would do nothing on its own, because the tracer starts its DSM processor only with the env var, so it's left to a follow-up. When a message already has the SQS maximum of 10 attributes, the pathway isn't written back, so forwarding those attributes still works.

Motivation

Go SQS consumers were missing from DSM, so pathways broke at Go hops. Replaces #4788, rebased onto the Enricher refactor. Accepting the double-encoded .NET context is out of scope.

Testing

Unit tests in internal/sqs and aws cover produce and consume through the middleware, String, Binary and SNS-envelope carriers, malformed input, and DSM off. go test -race ./... and golangci-lint pass on the module. BenchmarkEnrichResponse measures the per-message decode. End to end against LocalStack and a real agent, a producer, a forwarder and a consumer linked produce → consume → produce → consume across two queues.

Reviewers: apm-go for the receive-path decode, data-streams-monitoring for DSM behavior.

🤖 Generated with Claude Code

…ints

ReceiveMessage now sets a Data Streams consume checkpoint for each
returned message, chained from the producer's pathway in the _datadog
attribute (String or Binary), or from the SNS notification in the body
when SNS raw message delivery is off. The new pathway is written back
into the message's _datadog attribute so consumers can continue it.
ReceiveMessage asks for _datadog unless All or .* is already requested.

Data Streams follows the Kafka integrations: on with
DD_DATA_STREAMS_ENABLED, or per client with the new WithDataStreams
option. The produce checkpoint is gated on the same switch.

Refs DSM2-676

Environment: Datadog workspace

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 17, 2026

Copy link
Copy Markdown

DSM2-676

@github-actions github-actions Bot added the apm:ecosystem contrib/* related feature requests or bugs label Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Config Audit

PACKAGE: contrib/cloud.google.com/go/pubsubtrace
  STATUS      CONFIG                                            CALL_SITES
  UNMIGRATED  DD_GOOGLE_CLOUD_PUBSUB_PROPAGATION_AS_SPAN_LINKS  1

PACKAGE: contrib/confluentinc/confluent-kafka-go/kafkatrace
  STATUS      CONFIG                            CALL_SITES
  UNMIGRATED  DD_TRACE_KAFKA_ANALYTICS_ENABLED  1

PACKAGE: crashtracker
  STATUS      CONFIG                    CALL_SITES
  STILL_READ  DD_API_KEY                1
  STILL_READ  DD_SITE                   1
  STILL_READ  DD_TAGS                   1
  UNMIGRATED  DD_CRASHTRACKING_ENABLED  1

PACKAGE: ddtrace/opentelemetry/log
  STATUS      CONFIG                    CALL_SITES
  STILL_READ  DD_ENV                    1
  STILL_READ  DD_SERVICE                1
  STILL_READ  DD_TAGS                   1
  STILL_READ  DD_TRACE_REPORT_HOSTNAME  1
  STILL_READ  DD_VERSION                1
  UNMIGRATED  DD_HOSTNAME               1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES  1
  UNMIGRATED  OTEL_SERVICE_NAME         1

PACKAGE: ddtrace/opentelemetry/metric
  STATUS      CONFIG                    CALL_SITES
  STILL_READ  DD_ENV                    1
  STILL_READ  DD_METRICS_OTEL_ENABLED   1
  STILL_READ  DD_SERVICE                1
  STILL_READ  DD_TAGS                   1
  STILL_READ  DD_TRACE_REPORT_HOSTNAME  1
  STILL_READ  DD_VERSION                1
  STILL_READ  OTEL_METRICS_EXPORTER     1
  UNMIGRATED  DD_HOSTNAME               1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES  1
  UNMIGRATED  OTEL_SERVICE_NAME         1

PACKAGE: ddtrace/tracer
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT     1
  STILL_READ  DD_TRACE_PROPAGATION_EXTRACT_FIRST        1
  STILL_READ  DD_TRACE_PROPAGATION_STYLE_EXTRACT        1
  STILL_READ  DD_TRACE_PROPAGATION_STYLE_INJECT         1
  UNMIGRATED  DD_APM_TRACING_ENABLED                    1
  UNMIGRATED  DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED  1
  UNMIGRATED  DD_TRACE_DEBUG_SEELOG_WORKAROUND          1
  UNMIGRATED  OTEL_TRACES_SAMPLER_ARG                   1

PACKAGE: instrumentation
  STATUS      CONFIG                                       CALL_SITES
  STILL_READ  DD_DATA_STREAMS_ENABLED                      1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_ENABLED  1

PACKAGE: instrumentation/graphql
  STATUS      CONFIG                             CALL_SITES
  UNMIGRATED  DD_TRACE_GRAPHQL_ERROR_EXTENSIONS  1

PACKAGE: instrumentation/httptrace
  STATUS      CONFIG                                                 CALL_SITES
  UNMIGRATED  DD_GOOGLE_CLOUD_PUBSUB_PROPAGATION_AS_SPAN_LINKS       1
  UNMIGRATED  DD_HTTP_SERVER_TAG_QUERY_STRING_SIZE                   1
  UNMIGRATED  DD_TRACE_BAGGAGE_TAG_KEYS                              1
  UNMIGRATED  DD_TRACE_CLIENT_IP_ENABLED                             1
  UNMIGRATED  DD_TRACE_HTTP_SERVER_ERROR_STATUSES                    1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST               1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_CLIENT        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_SERVER        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_DISABLED                1
  UNMIGRATED  DD_TRACE_INFERRED_PROXY_SERVICES_ENABLED               1
  UNMIGRATED  DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP               2
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT  1
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ENABLED                     1

PACKAGE: instrumentation/internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal
  STATUS      CONFIG                         CALL_SITES
  STILL_READ  DD_AGENT_HOST                  1
  STILL_READ  DD_TAGS                        1
  STILL_READ  DD_TRACE_AGENT_PORT            1
  STILL_READ  DD_TRACE_AGENT_URL             1
  UNMIGRATED  DD_EXTERNAL_ENV                1
  UNMIGRATED  DD_GIT_COMMIT_SHA              1
  UNMIGRATED  DD_GIT_REPOSITORY_URL          1
  UNMIGRATED  DD_TRACE_GIT_METADATA_ENABLED  1

PACKAGE: internal/appsec
  STATUS      CONFIG           CALL_SITES
  UNMIGRATED  DD_APPSEC_RULES  1

PACKAGE: internal/appsec/config
  STATUS      CONFIG                                                CALL_SITES
  UNMIGRATED  DD_API_SECURITY_DOWNSTREAM_BODY_ANALYSIS_SAMPLE_RATE  1
  UNMIGRATED  DD_API_SECURITY_ENABLED                               1
  UNMIGRATED  DD_API_SECURITY_MAX_DOWNSTREAM_REQUEST_BODY_ANALYSIS  1
  UNMIGRATED  DD_API_SECURITY_PROXY_SAMPLE_RATE                     1
  UNMIGRATED  DD_API_SECURITY_REQUEST_SAMPLE_RATE                   1
  UNMIGRATED  DD_API_SECURITY_SAMPLE_DELAY                          1
  UNMIGRATED  DD_APM_TRACING_ENABLED                                1
  UNMIGRATED  DD_APPSEC_AGENTIC_ONBOARDING                          1
  UNMIGRATED  DD_APPSEC_DISABLE_FEATURES                            1
  UNMIGRATED  DD_APPSEC_ENABLED                                     2
  UNMIGRATED  DD_APPSEC_MAX_STACK_TRACE_DEPTH                       1
  UNMIGRATED  DD_APPSEC_RASP_ENABLED                                1
  UNMIGRATED  DD_APPSEC_RULES                                       1
  UNMIGRATED  DD_APPSEC_SCA_ENABLED                                 1
  UNMIGRATED  DD_APPSEC_STACK_TRACE_ENABLED                         1
  UNMIGRATED  DD_APPSEC_TRACE_RATE_LIMIT                            1
  UNMIGRATED  DD_APPSEC_WAF_TIMEOUT                                 1

PACKAGE: internal/bazel
  STATUS      CONFIG                                  CALL_SITES
  UNMIGRATED  DD_TEST_OPTIMIZATION_MANIFEST_FILE      1
  UNMIGRATED  DD_TEST_OPTIMIZATION_PAYLOADS_IN_FILES  1

PACKAGE: internal/civisibility/envconfig
  STATUS      CONFIG                   CALL_SITES
  STILL_READ  DD_CIVISIBILITY_ENABLED  1

PACKAGE: internal/civisibility/integrations
  STATUS      CONFIG                                               CALL_SITES
  STILL_READ  DD_SERVICE                                           1
  STILL_READ  DD_TRACE_DEBUG                                       1
  UNMIGRATED  DD_CIVISIBILITY_CODE_COVERAGE_REPORT_UPLOAD_ENABLED  1
  UNMIGRATED  DD_CIVISIBILITY_DYNAMIC_ATR_BUCKETS                  1
  UNMIGRATED  DD_CIVISIBILITY_DYNAMIC_ATR_ENABLED                  1
  UNMIGRATED  DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_ENABLED        1
  UNMIGRATED  DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_MAX_RETRIES    1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_COUNT                    1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_ENABLED                  1
  UNMIGRATED  DD_CIVISIBILITY_GIT_UPLOAD_ENABLED                   1
  UNMIGRATED  DD_CIVISIBILITY_IMPACTED_TESTS_DETECTION_ENABLED     1
  UNMIGRATED  DD_CIVISIBILITY_SUBTEST_FEATURES_ENABLED             1
  UNMIGRATED  DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT              1
  UNMIGRATED  DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                           1

PACKAGE: internal/civisibility/integrations/gotesting
  STATUS      CONFIG                                                           CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_INTERNAL_PARALLEL_EARLY_FLAKE_DETECTION_ENABLED  2
  UNMIGRATED  DD_CIVISIBILITY_RETRY_EXECUTION_MODE                             1
  UNMIGRATED  DD_CIVISIBILITY_RETRY_PROCESS_MAX_CONCURRENCY                    1
  UNMIGRATED  DD_CIVISIBILITY_RETRY_PROCESS_TIMEOUT                            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                                       2

PACKAGE: internal/civisibility/integrations/logs
  STATUS      CONFIG                        CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_LOGS_ENABLED  1

PACKAGE: internal/civisibility/utils
  STATUS      CONFIG                              CALL_SITES
  STILL_READ  DD_SERVICE                          1
  UNMIGRATED  DD_ACTION_EXECUTION_ID              1
  UNMIGRATED  DD_PIPELINE_EXECUTION_ID            1
  UNMIGRATED  DD_TEST_OPTIMIZATION_ENV_DATA_FILE  1
  UNMIGRATED  DD_TEST_SESSION_NAME                1

PACKAGE: internal/civisibility/utils/net
  STATUS      CONFIG                             CALL_SITES
  STILL_READ  DD_API_KEY                         1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_ENABLED  1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_URL      1
  STILL_READ  DD_ENV                             1
  STILL_READ  DD_SERVICE                         1
  STILL_READ  DD_SITE                            1
  STILL_READ  DD_TAGS                            1
  STILL_READ  DD_VERSION                         1
  UNMIGRATED  DD_CODE_COVERAGE_FLAGS             1

PACKAGE: internal/civisibility/utils/telemetry
  STATUS      CONFIG                                         CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER  1

PACKAGE: internal/clientip
  STATUS      CONFIG                     CALL_SITES
  UNMIGRATED  DD_TRACE_CLIENT_IP_HEADER  1

PACKAGE: internal/globalconfig
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_ID    1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TIME  1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TYPE  1

PACKAGE: internal/hostname
  STATUS      CONFIG       CALL_SITES
  UNMIGRATED  DD_HOSTNAME  1

PACKAGE: internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal/processtags
  STATUS      CONFIG                                          CALL_SITES
  UNMIGRATED  DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED  1

PACKAGE: internal/remoteconfig
  STATUS      CONFIG                                  CALL_SITES
  STILL_READ  DD_ENV                                  1
  UNMIGRATED  DD_RC_TUF_ROOT                          1
  UNMIGRATED  DD_REMOTE_CONFIGURATION_ENABLED         1
  UNMIGRATED  DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS  1

PACKAGE: internal/telemetry
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_API_KEY                                         1
  STILL_READ  DD_SITE                                            1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT  1
  UNMIGRATED  DD_INSTRUMENTATION_TELEMETRY_ENABLED               1
  UNMIGRATED  DD_TELEMETRY_DEBUG                                 1
  UNMIGRATED  DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED         1
  UNMIGRATED  DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL           1
  UNMIGRATED  DD_TELEMETRY_HEARTBEAT_INTERVAL                    1
  UNMIGRATED  DD_TELEMETRY_LOG_COLLECTION_ENABLED                1
  UNMIGRATED  DD_TELEMETRY_METRICS_ENABLED                       1

PACKAGE: openfeature
  STATUS      CONFIG                                                     CALL_SITES
  STILL_READ  DD_ENV                                                     2
  STILL_READ  DD_SERVICE                                                 2
  STILL_READ  DD_VERSION                                                 2
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED  1
  UNMIGRATED  DD_FLAGGING_EVALUATION_COUNTS_ENABLED                      1

PACKAGE: profiler
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_API_KEY                                1
  STILL_READ  DD_ENV                                    1
  STILL_READ  DD_SERVICE                                1
  STILL_READ  DD_SITE                                   1
  STILL_READ  DD_TAGS                                   1
  STILL_READ  DD_TRACE_STARTUP_LOGS                     1
  STILL_READ  DD_VERSION                                1
  UNMIGRATED  DD_PROFILING_AGENTLESS                    1
  UNMIGRATED  DD_PROFILING_DEBUG_COMPRESSION_SETTINGS   1
  UNMIGRATED  DD_PROFILING_DELTA                        1
  UNMIGRATED  DD_PROFILING_ENABLED                      3
  UNMIGRATED  DD_PROFILING_ENDPOINT_COUNT_ENABLED       1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_ENABLED      1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_LIMIT_BYTES  1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_PERIOD       1
  UNMIGRATED  DD_PROFILING_FLUSH_ON_EXIT                1
  UNMIGRATED  DD_PROFILING_OUTPUT_DIR                   1
  UNMIGRATED  DD_PROFILING_UPLOAD_TIMEOUT               1
  UNMIGRATED  DD_PROFILING_URL                          1

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 95.83%
• Overall Coverage: 74.74% (+0.73%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: dd3d968 | Docs | View more details | Give us feedback!

@dd-octo-sts dd-octo-sts Bot mentioned this pull request Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@arp review

@robcarlan-datadog
robcarlan-datadog marked this pull request as ready for review November 17, 2026 16:06
@robcarlan-datadog
robcarlan-datadog requested review from a team as code owners November 17, 2026 16:06
@robcarlan-datadog
robcarlan-datadog requested review from rarguelloF and removed request for a team November 17, 2026 16:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T18:57:14.751480Z 3782227 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@robcarlan-datadog
robcarlan-datadog marked this pull request as draft November 17, 2026 16:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18abf17f57

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread contrib/aws/aws-sdk-go-v2/aws/option.go Resolved

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

The most critical production concern is that WithDataStreams() does not wire into DSM processor activation, so all checkpoints silently no-op when DD_DATA_STREAMS_ENABLED is unset with the real tracer. A second distinct issue is that injecting the _datadog attribute on a fully-loaded 10-attribute SQS message exceeds SQS's attribute limit, causing downstream send operations to be rejected.

Open Bits AI session

🤖 Bits Code Review · Commit 18abf17

Comment thread contrib/aws/aws-sdk-go-v2/aws/option.go Resolved
@robcarlan-datadog
robcarlan-datadog marked this pull request as ready for review November 17, 2026 16:14
…e, document WithDataStreams

ReceiveMessage no longer adds _datadog to a message that already has the
SQS maximum of 10 attributes, so forwarding those attributes still
succeeds. The consume checkpoint is still set.

The tracer creates its Data Streams processor only when
DD_DATA_STREAMS_ENABLED is set, so WithDataStreams has no effect on its
own, as in the Kafka integrations. The godoc now says so.

Refs DSM2-676

Environment: Datadog workspace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The PR adds AWS SDK v2 SQS consume checkpoints with producer/SNS pathway propagation. The update prevents eleventh-attribute insertion and corrects the WithDataStreams() contract to require DD_DATA_STREAMS_ENABLED=true at tracer startup; both earlier findings are resolved, with no open findings remaining.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 5763506

The tracer starts its Data Streams processor only when
DD_DATA_STREAMS_ENABLED is set, so the option had no effect on its own.
SQS Data Streams Monitoring now follows that setting only. Making a
per-integration option work needs a tracer change, tracked separately.

Refs DSM2-676

Environment: Datadog workspace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… limit

traceBudget.inject refused to inject whenever a message had 10 attributes,
even when one of them was _datadog and injection would only replace it.
Since ReceiveMessage now requests and writes back _datadog, forwarding a
received message with 9 user attributes sent the upstream producer's trace
context and the consume-side pathway instead of the current span's.

The limit now applies only when _datadog would be added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

With DSM enabled, receiving a valid message at SQS’s 1 MiB limit adds a pathway attribute that makes it too large to forward. The existing send-side guard leaves those oversized received attributes intact.

Open Bits AI session

🤖 Bits Code Review · Commit ec4aaa5

… checkpoints

setConsumeCheckpoint wrote the _datadog attribute into received messages
after only checking the attribute-count limit, so a message with a body
near the 1 MiB payload limit grew past it when forwarded. Route the write
through the same trace budget the send paths use, which skips the
attribute when it would exceed the limit or when malformed UTF-8 would
expand past it, while still recording the consume checkpoint.

Environment: Datadog workspace

Co-Authored-By: Claude Code <noreply@anthropic.com>

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

The PR adds AWS SDK v2 SQS DSM produce and consume checkpoints under DD_DATA_STREAMS_ENABLED.
It propagates pathways through message attributes and SNS envelopes.
The new commit fixes the reported single-message byte-limit overflow.
One issue remains: receive-added attributes can overflow a forwarded batch’s aggregate 1 MiB budget.
The batch send path preserves those attributes, causing SQS rejection.

Open Bits AI session

🤖 Bits Code Review · Commit bf8cd33

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: bf8cd33be9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…eds the byte limit

Forwarding received messages in one SendMessageBatch can push the batch
past SQS's aggregate payload limit: each message passed the per-message
budget at receive and gained _datadog, but their combined size exceeds
the limit the batch path enforces across all entries. When the batch
budget cannot absorb a write, remove the entry's stale _datadog instead
of preserving it, so a batch the caller could have sent without the
tracer still goes through. Covered by TestForwardDropsDatadogAtBatchByteLimit.

Environment: Datadog workspace

Co-Authored-By: Claude Code <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 18ef0b4191

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

The two most critical issues are: (1) freed bytes from deleted _datadog attributes are never credited back to the shared batch byte budget, causing later entries to unnecessarily lose trace/DSM context in near-limit batches; and (2) the aggregate-budget setup and size-repair logic are incorrectly gated on canInject, so batches can still exceed SQS's 1 MiB limit when injection is disabled but DSM enrichment is active.

Open Bits AI session

🤖 Bits Code Review · Commit 18ef0b4

… the enricher

Stripping a stale _datadog from a batch entry freed its bytes but the
aggregate budget never saw them, so later entries that would fit in that
room needlessly lost their injection. Credit the removed attribute's
size, and its UTF-8 expansion when it was already counted, back to the
budget. The aggregate budget and the strip also ran only while trace
injection was enabled, so with DSM on and injection disabled a forwarded
batch of received near-limit messages could still exceed the aggregate
limit; build the budget and strip independently of injection, dropping
_datadog from entries while the batch is over the limit.

Environment: Datadog workspace

Co-Authored-By: Claude Code <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 3782227e73

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The PR adds SQS consume checkpoints under DD_DATA_STREAMS_ENABLED, with the ineffective per-client option removed and attribute/byte-limit safeguards retained. Stripped metadata now replenishes the batch budget, preserving later context when it fits, and size repair runs with injection disabled; all reported findings are resolved.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 3782227

@kakkoyun kakkoyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One change is needed before this can merge. See the inline comment.


messageSize := sendMessageSize(params)
traceContext, err := getTraceContext(ctx, span, queueName(params.QueueUrl), messageSize)
traceContext, err := e.getTraceContext(ctx, span, queueName(params.QueueUrl), messageSize)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In handleSendMessage, remove an existing _datadog attribute when budget.inject returns nil, matching handleSendMessageBatch. When a forwarded message already holds a consume checkpoint and fills the byte budget, handleSendMessage now sends the stale _datadog attribute unchanged. Add a single-send test similar to TestForwardDropsDatadogAtBatchByteLimit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a3682ad: handleSendMessage now strips an existing _datadog attribute when budget.inject returns nil, mirroring handleSendMessageBatch, and TestForwardDropsDatadogAtByteLimit covers the single-send case.

…d exceeds the byte limit

handleSendMessage left an existing _datadog attribute in place when the
trace budget could not fit the fresh context, forwarding the stale
consume checkpoint instead of dropping it. Strip the attribute the way
handleSendMessageBatch does, copying the attribute map so the caller's
stays untouched.

Environment: Datadog workspace

Co-Authored-By: Claude Code <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

@DataDog review

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

A consumer that receives nine user attributes, adds another, and forwards the message can send eleven attributes after the new consume checkpoint is added. SQS rejects these otherwise valid messages.

Open Bits AI session

🤖 Bits Code Review · Commit a3682ad

Co-authored-by: datadog-prod-us1-3[bot] <266080212+datadog-prod-us1-3[bot]@users.noreply.github.com>
@robcarlan-datadog

Copy link
Copy Markdown
Contributor Author

@DataDog review

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

No reportable defect was identified in the SQS checkpoint propagation paths. Focused execution remains unverified because the static reviewer’s dependency proxy was unreachable.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit dd3d968

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apm:ecosystem contrib/* related feature requests or bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants